package com.kfm.servlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

@WebServlet("/online")
public class OnlineServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ServletContext servletContext = req.getServletContext();
        AtomicInteger numbers = (AtomicInteger) servletContext.getAttribute("numbers");
        req.setAttribute("numbers", numbers.get());
        req.setAttribute("self", req.getSession().getId());
        req.getRequestDispatcher("/WEB-INF/online.jsp").forward(req, resp);
    }
}
